﻿<UserControl
    x:Class="JV.Com.Views.Wrapper.GameArticleWrapper"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:JV.Com.Views.Wrapper"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="80" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Border BorderBrush="{StaticResource DataItemBorderThemeBrush}" BorderThickness="1" Margin="0, 0, 5, 0">
            <Image Source="{Binding SmallImageUrl}" Stretch="UniformToFill"
                                           HorizontalAlignment="Center" VerticalAlignment="Center" />
        </Border>

        <Grid Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="20" />
                <RowDefinition Height="20" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <TextBlock Text="{Binding Title}" Style="{StaticResource TitleItemTextBlockStyle}"
                                                       TextAlignment="Left" TextWrapping="NoWrap" TextTrimming="WordEllipsis" />
            <TextBlock Grid.Row="1" TextAlignment="Left" Style="{StaticResource SummaryItemTextBlockStyle}" Text="{Binding Summary}" />
            <ItemsControl ItemsSource="{Binding Machines}" Grid.Row="2"
                          VerticalAlignment="Bottom" HorizontalAlignment="Left">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Image Stretch="None" Source="{Binding Converter={StaticResource BytesToImageConverter}}" />
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal" />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemContainerStyle>
                    <Style TargetType="ContentPresenter">
                        <Setter Property="Margin" Value="0, 0, 5, 0" />
                    </Style>
                </ItemsControl.ItemContainerStyle>
            </ItemsControl>
        </Grid>
    </Grid>
</UserControl>
